<%@ page import="cn.com.betasoft.groovy.templates2.exceptions.Message; cn.com.betasoft.groovy.templates2.exceptions.TemplateParseException; cn.com.betasoft.groovy.templates2.exceptions.TemplateExecutionException; cn.com.betasoft.groovy.templates2.exceptions.TemplateCompilationException; cn.com.betasoft.groovy.templates2.exceptions.TemplateException" %>
<div><%~error%></div>
<br>
<%if (exception.getCause() != null ){
    StringBuffer traces = new StringBuffer();
    for (StackTraceElement element : exception.getCause().getStackTrace()) {
        traces.append(element.toString()).append("\n")
    }%>
    <textarea rows="20" cols="100" readonly="true"><%~ traces%></textarea>
<%}%>
<%if (exception instanceof TemplateException){%>
  <blockquote>
      <%~exception.getErrorDescription() %>
  </blockquote>
<%}%>
<%if (exception instanceof TemplateParseException || exception instanceof TemplateCompilationException || exception instanceof TemplateExecutionException){%>
    <blockquote>

        <%if(exception instanceof TemplateCompilationException ){ %>
        <legend>消息</legend>
        <ol>
        <%  for(Message msg : exception.getMessages()) { %>
           <li>
                <%~  msg.getDescription() %>
           </li>
        <% }%>
        </ol>
        <% } else { %>
          <legend>
              错误文件:
              <%~exception.template.getSourceFile() %><br/>
              错误行号:
              <%~exception.getTemplateLineNumber()%>
          </legend>
        <% } %>
        <legend>源文件</legend>
        <textarea rows="20" cols="100" readonly="true"><%~ exception.template.templateSource %></textarea>
        <legend>编译结果:</legend>
        <textarea rows="20" cols="100" readonly="true"><%~ exception.template.compiledSource %></textarea>
    </blockquote>
<%}%>
<br>
<br>
<a href="javascript:history.go(-1)">返回</a>